﻿using RpcExtend.Model;
using RpcExtend.Model.DB;

namespace RpcExtend.DAL.Repository
{
    internal class RemoteServerConfigDAL : IRemoteServerConfigDAL
    {
        private IRpcBasicRepository<RemoteServerConfigModel> _BasicDAL;

        public RemoteServerConfigDAL(IRpcBasicRepository<RemoteServerConfigModel> dal)
        {
            _BasicDAL = dal;
        }

        public RemoteServerConfig GetServer(long serverId)
        {
            return this._BasicDAL.Get(c => c.Id == serverId, c => new RemoteServerConfig
            {
                ConIp = c.ConIp,
                RemoteIp = c.RemoteIp,
                ServerIp = c.ServerIp,
                ServerName = c.ServerName,
                ServerPort = c.ServerPort
            });
        }
    }
}
